<template>
	<view>
		<view class="item" v-for="(item,index) in list" :key='index'>
			<view class="avatar">
				<image :src="item.avatar" mode=""></image>
			</view>
			<view class="detail">
				<view class="title">
					{{ item.nickname }}
				</view>
				<view class="num">
					{{ item.phone }}
				</view>
			</view>
		</view>
		
		
	</view>
</template>

<script>
	import {
		mapState,
		mapActions
	} from 'vuex'
	export default {
		computed: {
			...mapState(['token'])
		},
		data() {
			return {
				//活动Id
				id:'',
				list:[],
				type:''
			};
		},
		onLoad(options) {
			if(options.type==0){
				uni.setNavigationBarTitle({
					title:'报名的男士'
				})
				this.type = 1;
			}else{
				uni.setNavigationBarTitle({
					title:'报名的女士'
				})
				this.type = 2;
			}
			this.id = options.id;
			
			this.getData();
			
		},
		methods:{
			//获取数据
			async getData() {
				try {
					let params = {
						token: this.token,
						orderId:this.id,
						gender:this.type
						
					};
					let res = await this.$request.request.get('/api/engagement/launch', params)
					console.log(res);
					if (res.code == 200) {
						if(res.data.length > 0){
							this.list = res.data;
						}else{
							uni.showToast({
								title:'暂无数据!',
								mask:true,
								duration:1000
							});
							
							setTimeout(()=> {
								uni.navigateBack({
									delta:1
								})
							},1000)
							
						}
					}
				} catch (err) {
					this.$request.error(err, this)
				}
			}
		}
	}
</script>

<style lang="scss">
@import 'participants.scss';
</style>
